package file;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.InputStreamReader;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-07-10
 * Time: 20:39
 */
public class Main {
    public static void main(String[] args) {
        BufferedReader input = null;
        BufferedWriter bw = null;
        try {
            input = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new FileWriter("D:\\JAVA\\java\\homework230618\\test.txt"));
            while(true) {
                String s = input.readLine();
                if(s.equals("exit")||s.equals("EXIT"))
                    break;
                System.out.println(s);
                bw.write(s);
                bw.newLine();
            }
            bw.flush();
            bw.close();
        } catch(Exception ex){
            ex.printStackTrace();
        } finally {
            try {
                input.close();
            } catch(Exception ex) {
                ex.printStackTrace();
            }
        }
    }
}
